#include "ExcelBinaryFile.h"


ExcelBinaryFile::ExcelBinaryFile(string filePath)
{
	fileName = filePath;
	fileResult = SUCCESS;
	ReadContent();
	
}


ExcelBinaryFile::~ExcelBinaryFile()
{
}

std::string ExcelBinaryFile::ParagraphText()
{
	return sb;
}

ERRORTYPE ExcelBinaryFile::getResult()
{
	return fileResult;
}

void ExcelBinaryFile::ReadContent()
{
	int result = 0;
	WorkBook foo(fileName, result);
	if (foo.error1 == 0)
	{
		cellContent cell = foo.GetCell(0, 1, 2);
		foo.ShowCell(cell);

		for (int sheetNum = 0; sheetNum < foo.GetSheetCount(); ++sheetNum) {
			if (sheetNum) printf("\n\n");
			printf("===>>> SheetName: %s\n\n", foo.GetSheetName(sheetNum).c_str());
			sb += foo.GetSheetName(sheetNum);
			foo.InitIterator(sheetNum);
			while (true) {
				cellContent c = foo.GetNextCell();
				if (c.type == cellBlank) break;
				//foo.ShowCell(c);
				sb += c.str;

			}
		}
	}
	else
	{
		fileResult = (ERRORTYPE)(result + 6);
	} 
	


}
